#include <iostream>
#include <cstdio>
#include <memory>
#include "Usage.hpp"
#include "Click.hpp"
#include "Socket.h"
#include "Protocol.hpp"
void HandlerHttpRequest(int socket)
{
    bool quit = false;
    std::string buffer;
    while(!quit)
    {
        // 1. 获取需求
        Request req;
        std::cout << "Please Enter # ";
        std::cin >> req._x >> req._op >> req._y;
        // 2. 序列化
        std::string s = req.Serialize();
        // std::string temp = s;
        // 3. 添加长度报头
        s = Encode(s);
        // 4. 发送给服务端
        Send(sockfd, s);


    }

}
int main(int argc,char* argv[])
{
    if(argc!=3)
    {
        Usage(argv[1]);
        exit(1);
    }
    std::unique_ptr<Click> httpclick(new Click(atoi(argv[2]), HandlerHttpRequest));
    return 0;
}